<php>
	$this->display(tpl('head',true));
</php>
<style>
	.layui-table thead tr th{
		text-align: center;
	}
</style>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  	<legend>友情链接管理</legend>
</fieldset>
<table class="layui-table" cellspacing="0" cellpadding="0" border="0"  lay-filter="demoEvent">
	<thead>
		<tr>
			<th width="40">Id</th>
			<th>名称</th>
			<th width="100">链接</th>
			<th width="100">所属分类</th>
			<th width="100">站标</th>
			<th width="100">有效期</th>
			<th width="100">显示方式</th>
			<th width="100">状态</th>
			<th width="130">操作</th>
		</tr>
	</thead>
	<tbody>
		<foreach array="data">
		<tr>
			<td align="center">{{$row['id'] }}</td>
			<td>{{$row['title'] }}</td>
			<td align="center">{{$row['link'] }}</td>
			<td align="center">{{$row['name'] }}</td>
			<td>
				<if condition="$row['thumb']">
				<php>
					if(preg_match('/(http|https):\/\/([\w\d\-_]+[\.\w\d\-_]+)[:\d+]?([\/]?[\w\/\.]+)/', $row['thumb'] )){ 
						$thumb=$row['thumb'];
					}else{ 
						$thumb=get_img_url($row['thumb']);
					}
				</php>
				<img src="{{$thumb }}" width="120" height="35"/>
				</if>
			</td>
			<td align="center">{{ $row['vld'] ? date('Y-m-d',$row['vld']) : '长期有效'; }}</td>
			<td align="center">
				{{$row['is_w'] ? '文字' : '图标'}}
			</td>
			<td align="center">
				<if condition="$row['state']==1">
					<span class="green">已审并显示</span>
				<elseif condition="$row['state']==0">
					<span class="blue">待审核</span>
				<elseif condition="$row['state']=='-1'">
					<span class="red">黑名单</span>
				<else>
					<span class="red">已拒绝</span>
				</if>
			</td>
			<td align="center">
				<a class="layui-btn layui-btn-sm layui-btn-warm" href="{{PLUGIN_ACTION }}friend/edit/id_{{$row['id'] }}">编辑</a>
				<a class="layui-btn layui-btn-sm layui-btn-danger" href="{{PLUGIN_ACTION }}friend/del/id_{{$row['id'] }}">删除</a>
			</td>
		</tr>
		</foreach>
	</tbody>
</table>
<div class="page">
	{{$Get_Page }}
</div>
<php>
	$this->display(tpl('foot',true));
</php>
